import { requestFunc, responseErrorFunc, responseSuccessFunc } from './interceptor.js';
import data from './data/index.js';

export const httpBaseConfig = {
	timeout: 5000,
	interceptors: {
		responseSuccess: responseSuccessFunc,
		responseError: responseErrorFunc,
		request: requestFunc,
	},
	customFetch: async (a, b) => {
		await new Promise(resolve => {
			setTimeout(resolve, 500);
		});
		const response = await data(a, b);
		return {
			text: () => JSON.stringify({
				code: 200,
				msg: '成功',
				data: response
			})
		}
	}
};
const baseURL = 'http://xxx';
export const httpConfig1 = { baseURL, ...httpBaseConfig };
export const api1 = new JiessHttp(httpConfig1);